import { post } from "../../../utils/request";
const env = import.meta.env;

const apiRole = {
  queryRoleListing(data?: object) {
    return post(
      env.VITE_API_ADMIN_CONTEXT_PATH + "/admin/api/role.listing",
      data
    );
  },
  getRole(roleId: string) {
    return post(env.VITE_API_ADMIN_CONTEXT_PATH + "/admin/api/role.get", {
      roleId: roleId,
    });
  },
  queryAllRole() {
    return post(env.VITE_API_ADMIN_CONTEXT_PATH + "/admin/api/role.all", {});
  },
  updateRole(data?: object) {
    return post(
      env.VITE_API_ADMIN_CONTEXT_PATH + "/admin/api/role.update",
      data
    );
  },
  deleteRole(roleId: string) {
    return post(env.VITE_API_ADMIN_CONTEXT_PATH + "/admin/api/role.delete", {
      roleId,
    });
  },
  queryRoleCheckResourceIds(roleId: string) {
    return post(
      env.VITE_API_ADMIN_CONTEXT_PATH + "/admin/api/role.resource.checked",
      { roleId }
    );
  },
};

export default apiRole;
